<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('storage_configs', function (Blueprint $table) {
            $table->id();
            $table->string('type', 50)->comment('存储类型：local, aliyun_oss, tencent_cos, qiniu');
            $table->string('name', 100)->comment('配置名称');
            $table->boolean('is_default')->default(false)->comment('是否默认');
            $table->json('config')->nullable()->comment('存储配置（JSON）');
            $table->tinyInteger('status')->default(1)->comment('状态：1-启用，0-禁用');
            $table->text('remark')->nullable()->comment('备注');
            $table->timestamps();

            $table->index('type');
            $table->index('is_default');
            $table->index('status');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('storage_configs');
    }
};

